import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  // 主页
  {
    path: "/home",
    component: resolve => require(["../views/home/home.vue"], resolve),
    meta: {
      title: "旺旺小小圈blog"
    }
  },
  // 文章详情
  {
    path: "/articles/:id",
    component: resolve => require(["../views/acticles/acticleDetail.vue"], resolve)
  },
  // 相册主页
  {
    path: "/album",
    component: resolve => require(["../views/photo/album.vue"], resolve)
  },
  // 相册详情
  {
    path: "/album/:albumId",
    component: resolve => require(["../views/photo/photo.vue"], resolve)
  },
  // 归档
  {
    path: "/archive",
    component: resolve => require(["../views/archive/Archive.vue"], resolve)
  },
  // 分类
  {
    path: "/category",
    component: resolve => require(["../views/category/Category.vue"], resolve)
  },
  // 标签
  {
    path: "/tag",
    component: resolve => require(["../views/tag/Tag.vue"], resolve)
  },

  {
    path: "/categories/:categoryId",
    component: resolve => require(["../views/acticles/ArticleList.vue"], resolve)
  },

  {
    path: "/projectList/",
    component: resolve => require(["../views/project/projectList.vue"], resolve)
  },

  {
    path: "/project/:projectId",
    component: resolve => require(["../views/project/projectDetail.vue"], resolve)
  },

  {
    path: "/tags/:tagId",
    component: resolve => require(["../views/acticles/ArticleList.vue"], resolve)
  },
  {
    path: "/about",
    component: resolve => require(["../views/about/About.vue"], resolve),
    meta: {
      title: "关于我"
    }
  }

];

const router = new VueRouter({
  mode: "history",
  routes
});

export default router;
